<div class="submission_details_dialog">
  <h1 class="assignment-name">{{assignment.name}}</h1>
  <section class="submission-details">
    <form class="submission_details_grade_form form-inline">
      <strong><label for="{{label}}">{{#t 'grade_form_label'}}Grade:{{/t}}</label></strong>
      {{> grading_box}}
      {{#unless isInPastGradingPeriodAndNotAdmin}}
        <button style="float: right;" class="btn" type="submit">{{#t "update_grade"}}Update Grade{{/t}}</button>
      {{/unless}}
    </form>
    {{#if speedGraderUrl }}
      <a class="more-details-link" target="_blank" href="{{speedGraderUrl}}">{{#t "more_details_in_the_speedgrader"}}More details in the SpeedGrader{{/t}}</a>
    {{/if}}
    <div>
      <h2>
        {{#if moreThanOneSubmission}}
          <label for="submission_to_view">{{#t "this_was_submitted_multiple_times_choose_a_submission_to_view"}}Submitted multiple times, choose which to view:{{/t}}</label>
          <select id="submission_to_view">
            {{#each submission_history}}
              <option>{{datetimeFormatted submitted_at}} {{#if late}} {{#t "late"}}LATE{{/t}} {{/if}}</option>
            {{/each}}
          </select>
        {{else}}
          {{#if submitted_at}}
            <strong>{{#t "submitted"}}Submitted:{{/t}} {{datetimeFormatted submitted_at}} {{#if late}} {{#t "late"}}LATE{{/t}} {{/if}}</strong>
          {{/if}}
        {{/if}}
      </h2>
      {{#each submission_history}}
        {{> submission_detail}}
      {{/each}}
      {{#if rubric_assessment}}
        <div class="rubric-link"><a class="rubric" href="{{speedGraderUrl}}">{{#t "view_rubric_assessment_in_the_speedgrader"}}View Rubric Assessment in the SpeedGrader{{/t}}</a></div>
      {{/if}}
    </div>
  </section>
  <section>
    {{#if loading}}
      <h1>{{#t "loading_comments"}}Loading comments...{{/t}}</h1>
    {{else}}
      {{#if submission_comments}}
        <h1>{{#t "comments"}}Comments{{/t}}</h1>
        <div class="submission_details_comments">
          {{#each submission_comments}}
            <article class="comment clearfix">
              {{friendlyDatetime created_at pubdate=true}}
              {{>avatar author}}
              <div class="middle">
                <address class="vcard">
                  <a class="fn url" href="{{url}}">{{author_name}}</a>
                </address>
                <div>
                  {{newlinesToBreak comment}}
                </div>
                {{#if media_comment}}
                  <a data-media_comment_id="{{media_comment.media_id}}" data-media_comment_type="{{media_comment.media_type}}" href="{{media_comment.url}}" class="play_comment_link media-comment instructure_inline_media_comment" >{{#t "links.click_to_view"}}click here to view{{/t}}</a>
                {{/if}}
                <div class="comment_attachments">
                  {{#each attachments}}
                    <div><a href="{{url}}" class="{{mimeClass content-type}}" title="{{filename}}">{{display_name}}</a></div>
                  {{/each}}
                </div>
              </div>
            </article>
          {{/each}}
        </div>
      {{/if}}
    {{/if}}
  </section>
  <form class="submission_details_add_comment_form clearfix">
    <label for="add_a_comment">{{#t "add_a_comment"}}Add a comment{{/t}}</label>
    <textarea id="add_a_comment" name="comment[text_comment]"></textarea>
    {{#if assignment.group_category_id}}
    <span id="group-comment-container">
      {{checkbox "comment.group_comment" id="group_comment"}}
      <label for="group_comment">{{#t "labels.group_comment"}}Send Comment to the Whole Group{{/t}}</label>
    </span>
    {{/if}}
    <button class="btn" type="submit">{{#t "post_comment"}}Post Comment{{/t}}</button>
  </form>
</div>
